package com.mrzhou.auth.authorzation;

import com.mrzhou.auth.exception.IntegrationException;
import com.mrzhou.auth.service.CloudUserDetails;
import com.mrzhou.auth.support.IntegrationAuthenticationEntity;

/**
 *  各种认证类型实现此接口, 以便后续添加新的登录业务处理方式
 */
public interface IntegrationAuthenticationService {

    /**
     * 各种类型登陆的认证处理逻辑
     */
    CloudUserDetails authentication(IntegrationAuthenticationEntity authEntity) throws IntegrationException;

    /**
     * 进行预处理
     */
    void prepare(IntegrationAuthenticationEntity authEntity) throws IntegrationException;

    /**
     *  判断当前需要使用哪种认证方式处理登录逻辑
     */
    boolean support(IntegrationAuthenticationEntity authEntity);

    /**
     * 认证结束后执行
     */
    void complete(IntegrationAuthenticationEntity authEntity) throws IntegrationException;

}
